package dmqm.mall.mapper;

import dmqm.mall.model.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProductMapper {
    @Select("select * from mall_product")
    List<Product> List();

    @Insert("insert into product(id,name,price,num,icon,remark,create_time,update_time) values (#{id},#{name},#{price},#{num},#{icon},#{remark},#{createTime},#{updateTime})")
    int Add(Product mall_product);

    @Update("update mall_product set name=#{name},price=#{price},num=#{num},icon=#{icon},remark=#{remark},update_time=#{updateTime} where id=#{id}")
    int Update(Product product);

    @Delete("delete * from mall_product where id=#{id}")
    int Delete(@Param("id") int id);

    @Select("select * from mall_product where id=#{id}")
    Product Get(@Param("id") int id);
}
